package de.tum.in.eist.poll.client.gui;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.VerticalPanel;

public class OverAllChartWidget extends WidgetContainer {

	private LectureChartWidget chart;
	private VerticalPanel mainPanel;
	
	public OverAllChartWidget() {
		super(false, true);
		init();
		addContent();
	}

	private void init() {
		int[] testStats = {1,2,3,4,5};
		chart = new LectureChartWidget(testStats,"Over-all statistic");
		mainPanel = new VerticalPanel();
		
		// Add styles
		mainPanel.addStyleName("lectureForm");
		
		addHideButtonClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				setVisible(false);
			}
		});
	}

	private void addContent() {
		mainPanel.add(chart);
		add(mainPanel);
	}
	
	public void update(int[] stats, String title) {
		chart.update(stats, title);
	}
}
